<!DOCTYPE html>
<html lang="en">
<style>
    ul.group-list li {
        white-space: nowrap;float: left;
        width: 150px; height: 25px;
        padding: 3px 5px;list-style-type: none;
        list-style-position: outside;border: 0px;margin: 0px;
    }
    input[type=checkbox], input[type=radio] {
        display: inline-block;
    }
</style>

{include file="Public/head"}

<body data-type="widgets">
<script src="/assets/js/theme.js"></script>
<div class="am-g tpl-g">

    {include file='Public:header'}
    {include file='Public:menu2'}



    <!-- 内容区域 -->
    <div class="tpl-content-wrapper" >
        <div class="row-content am-cf">
            <div class="row">

                <div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
                    <div class="widget am-cf">
                        <div class="widget-head am-cf">
                            <div class="widget-title am-fl">新增</div>
                            <div class="widget-function am-fr">
                                <a href="javascript:;" class="am-icon-cog"></a>
                            </div>
                        </div>
                        <div class="widget-body am-fr">
                            <form id="roleform" form="submit" method="post">
                                <!--新订单列表 基本信息-->
                                <div class="panel panel-default">
                                    <div class="panel-heading">
                                        <h3 class="panel-title text-center">基本信息</h3>
                                    </div>
                                    <div class="panel-body">
                                        <nav class="navbar navbar-default">
                                            <div class="collapse navbar-collapse">
                                                <div class="navbar-form pull-right margin">
                                                    <a href="{:url('Order/printOrder')}?order_id={$order.order_id}" target="_blank" data-toggle="tooltip" title="" class="btn btn-primary" data-original-title="打印订单">
                                                        <i class="fa fa-print"></i>打印配货单
                                                    </a>
                                                    <a onclick="javascript:history.back(-1);" data-toggle="tooltip" title="" class="btn btn-default" data-original-title="返回"><i class="fa fa-reply"></i></a>
                                                </div>
                                            </div>
                                        </nav>
                                        <table class="table table-bordered">
                                            <tbody>

                                            <tr>
                                                <td class="text-right">订单号:</td>
                                                <td class="text-center">{$order.order_sn}</td>
                                                <td class="text-right">下单时间:</td>
                                                <td class="text-center">{$order.add_time|date='Y-m-d H:i:s',###}</td>
                                            </tr>
                                            <tr>
                                                <td class="text-right">配送方式:</td>
                                                <td class="text-center">{$order.shipping_name}</td>
                                                <td class="text-right">配送费用:</td>
                                                <td class="text-center">{$order.shipping_price}</td>
                                            </tr>
                                            <tr>
                                                <td class="text-right">配送单号:</td>
                                                <td class="text-center">
                                                    <input class="input-sm" name="invoice_no" id="invoice_no" value="{notempty name='deliverylog'}{$deliverylog.0.invoice_no}{/notempty}">
                                                </td>
                                            </tr>
                                            </tbody></table>

                                    </div>
                                </div>
                                <!--新订单列表 收货人信息-->
                                <div class="panel panel-default">
                                    <div class="panel-heading">
                                        <h3 class="panel-title text-center">收货信息</h3>
                                    </div>
                                    <div class="panel-body">
                                        <table class="table table-bordered">
                                            <tbody>
                                            <tr>
                                                <td class="text-right">收货人:</td>
                                                <td class="text-center">{$order.consignee}</td>
                                                <td class="text-right">邮编:</td>
                                                <td class="text-center">{$order.zipcode}</td>

                                            </tr>
                                            <tr>
                                                <td class="text-right">地址:</td>
                                                <td class="text-center">{$order.address}</td>
                                                <td class="text-right">发票抬头</td>
                                                <td class="text-center">{$order.invoice_title}</td>
                                            </tr>
                                            <tr>
                                                <td class="text-right">电话:</td>
                                                <td class="text-center">{$order.mobile}</td>

                                            </tr>
                                            </tbody></table>

                                    </div>
                                </div>
                                <!--新订单列表 商品信息-->
                                {notempty name="goods"}
                                <div class="panel panel-default">
                                    <div class="panel-heading">
                                        <h3 class="panel-title text-center">商品信息</h3>
                                    </div>
                                    <div class="panel-body">
                                        <table class="table table-bordered">
                                            <thead>
                                                <tr>
                                                    <td class="text-left">商品</td>
                                                    <td class="text-left">属性</td>
                                                    <td class="text-left">购买数量</td>
                                                    <td class="text-left">商品单价</td>
                                                    <td class="text-left">是否发货</td>
                                                </tr>
                                            </thead>
                                            <tbody>
                                            {foreach name="goods" key="k" item="v"}
                                                <tr>
                                                    <td class="text-left"><a href="{:url('mobile/classify/goodsinfo')}?id={$v.goods_id}">{$v.goods_name}</a>
                                                    </td>
                                                    <td class="text-left">{$v.spec_key_name}</td>
                                                    <td class="text-left">{$v.goods_num}</td>
                                                    <td class="text-right">{$v.market_price}</td>
                                                    <td class="text-right">
                                                        {if $v.is_send==0}未发货{elseif $v.is_send==1}已发货{elseif $v.is_send==2}已换货{elseif $v.is_send==3}已退货{/if}

                                                    </td>
                                                </tr>
                                            {/foreach}
                                            </tbody>
                                        </table>

                                    </div>
                                </div>
                                {/notempty}
                                <!--发货状态下课修改订单号-->
                                <!--新订单列表 操作信息-->
                                {if $order.shipping_status==0}
                                <div class="panel panel-default">
                                    <div class="panel-heading">
                                        <h3 class="panel-title text-center">发货信息</h3>
                                    </div>
                                    <div class="panel-body">
                                        <table class="table table-bordered">
                                            <tbody>
                                            <tr>
                                                <td class="text-right col-sm-2 margin">发货单备注：</td>
                                                <td colspan="3">
                                                    <input type="hidden" name="order_id" value="{$order.order_id}">
                                                    <textarea name="note" placeholder="请输入操作备注" rows="3" class="form-control"></textarea>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td colspan="4">
                                                    <div class="form-group text-center">
                                                        <button  class="btn btn-primary" type="submit">确认发货</button>
                                                        <button onclick="history.go(-1)" class="btn btn-primary" type="button">返回</button>
                                                    </div>
                                                </td>
                                            </tr>
                                            </tbody>
                                        </table>
                                    </div>
                                </div>
                                {/if}
                                <!--新订单列表 操作记录信息-->
                                {notempty name="deliverylog"}
                                <div class="panel panel-default">
                                    <div class="panel-heading">
                                        <h3 class="panel-title text-center">发货记录</h3>
                                    </div>
                                    <div class="panel-body">
                                        <table class="table table-bordered">
                                            <thead>
                                            <tr>
                                                <td class="text-center">操作者</td>
                                                <td class="text-center">发货时间</td>
                                                <td class="text-center">发货单号</td>
                                                <td class="text-center">收货人</td>
                                                <td class="text-center">快递公司</td>
                                                <td class="text-center">备注</td>
                                                <td class="text-center">查看</td>
                                            </tr>
                                            </thead>
                                            <tbody>
                                            {foreach name="deliverylog" key="k" item="v"}
                                            <tr>

                                                <td class="text-center">{$admin[$v.admin_id]}</td>
                                                <td class="text-center">{$v.create_time}</td>
                                                <td class="text-center">{$v.id}</td>
                                                <td class="text-center">{$v.consignee}</td>
                                                <td class="text-center">{$v.shipping_name}</td>
                                                <td class="text-center">{$v.note}</td>
                                                <td class="text-center"><a href="http://www.kuaidi100.com/">物流</a></td>
                                            </tr>
                                            {/foreach}
                                            </tbody>
                                        </table>
                                    </div>
                                </div>
                                {/notempty}
                            </form>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
</div>

</body>
{include file='Public:script'}
{include file='Public:validation'}

<script>

    //提交
    function roleSubmit(){
        var form=document.getElementById("roleform");
        var formData=new FormData(form);
        $.ajax({
            url:"{:Url('addData')}",
            type:'POST',
            data:formData,
            async: false,
            cache: false,
            contentType: false, //不设置内容类型
            processData: false, //不处理数据
            success:function(res){
                if (res.code != 200) {
                    layer.msg(res.msg, {shade: 0.5, time: 2000,icon: 2});
                    return false;
                }
                layer.msg(res.msg, {shade: 0.5, time: 2000, icon: 1}, function(){
                    window.location.href=document.referrer;

                });
            }
        });
        // $.post("{:Url('addData')}", formData, function (res) {
        // if (res.code != 200) {
        //     layer.msg(res.msg, {shade: 0.5, time: 1000,icon: 2});
        //     return false;
        // }
        // layer.msg(res.msg, {shade: 0.5, time: 1000, icon: 1}, function () {
        //     // location.reload();
        //     location.href = "{:url('index')}";
        // });
        // });
        // $('#roleform').submit();
    }
</script>

</html>